function fun(str){
    // /?user=zhangsan&pwd=123
    let arr  =str.splice("?");
    // user=zhangsan&pwd=123
    let arr1 = arr.splice("&");
    // ["user=zhangsan","pwd=123"]
    
    return arr2.reduce((current, item) => {
        let arr3 = item.split("=");  //  ["username","zhangsan"]
        // ["pwd","123"];
        current[arr3[0]] = arr3[1];
        return current;
    }, {});



    // ["user","zhangsan"]["pwd","123"]
}